//对象的函数解构
let json = {
    a : 'JSPang',
    b : '技术胖'
}

//必须要加大括号
function fun({a,b = 'web'}){
    console.log(a,b);
}

//call function
fun(json);

//数组解构
let arr = ['JSPang','技术胖','老民'];

function fun1(a,b,c){
    console.log(a,b,c);
}

fun1(...arr);

//in 的用法
let obj = {
    a : '技术胖',
    b : 'JSPang'
}

console.log('a' in obj);
console.log('c' in obj);

console.log('数组空位判断!');
let arr2 = ['',,,];
console.log(0 in arr2);
console.log(1 in arr2);
console.log(2 in arr2);

//数组遍历,可以以下的方法
console.log('数组遍历的方法!');
let arr3 = ['JSPang','技术胖','老民'];

console.log('forEach!');
arr3.forEach((value,index) => console.log(index + ':' + value));

console.log('filter!');
arr3.filter(x => console.log(x));

console.log('some!');
arr3.some(x => console.log(x));

console.log('map方法 -- 替换');
console.log(arr3.map(x => 'web'));

console.log('to string 方法');
console.log(arr3.toString());

console.log('join 方法');
console.log(arr3.join('-'));